﻿@using MvcApplicationTest.Models
@model ManageModel
@{
    ViewBag.Title = "Admin Manager";
}

<h2>@ViewBag.Title.</h2>
<ul>
    <li>@Html.ActionLink("Change user balance", "ChangeUserBalance", "Home")</li>
    <li>@Html.ActionLink("Show today's orders", "ShowOrdersOfToday", "Home")</li>
    <li>@Html.ActionLink("Show all users' information", "ShowAllUser", "Home")</li>
    <li>
        <text id="IfCanOrderText">@ViewBag.CanOrderText</text>
        <input type="button" id="CanOrderBtn" value="Change" onclick="ChangeIfCanOrder()" canorder="@ViewBag.CanOrder" />
    </li>
    <li>
        <text>Today's Shop</text>
        @{
            if (ViewBag.ExpectedShops.Count > 0)
            {
                if (ViewBag.ExpectedShops.Count == 1)
                { 
            <p>
                @ViewBag.DropDownListValue<br />
                WhatToEat:  @ViewBag.WhatToEat
            </p>
                }
                else
                {
            <div id="expectedOrderTable">
                <table>
                    <tr>
                        <th style="padding: 10px">Order</th>
                        <th style="padding: 10px">Count</th>
                    </tr>
                    @{
                    foreach (var item in ViewBag.ExpectedShops)
                    {
                        <tr>
                            <td style="padding: 10px">@item.Shop</td>
                            <td style="padding: 10px">@item.Count</td>
                        </tr>
                    }
                    }
                    <br />
                     WhatToEat: @ViewBag.WhatToEat
                </table>
            </div>
                }
            }
            else
            {
            <p>
                Nothing Expected.<br/>
                WhatToEat: @ViewBag.WhatToEat
            </p>
            }
        }
    </li>
    <li>
        <div id="ChangeShopDiv">
            <text>Change Today's Shop</text>
            <input type="button" id="changeShopBtn" value="Change" onclick="ChangeShopBtn_OnClick()" dropDownValue="@ViewBag.WhatToEat"/>
        </div>
        <div id="dropDownList" style="display: none">
            @Html.DropDownList("dropDown", ViewBag.AllShops as IEnumerable<SelectListItem>)
            <input type="button" value="Ok" onclick="ChangeOkBtn_OnClick()" />
            <input type="button" value="Cancel" onclick="ChangeCancelBtn_OnClick()" />
        </div>
    </li>
</ul>



页面布局与manage相同
子页布局

change user balance
  checkbox displayuser balance addbalance_textboxlist
    okbutton
today's all order
    user order cost balance
export button
导出所有订餐信息(发短信打电话使用)



order page页面不选checkbox时后台出错
model.hiddenvalue=null

register时无法动态获取到user输入的username


change password页面如何在点击change display name后
回到后台给viewBag.isChangeDisplayName赋值 true

manage页面应该设置 order now, view today's order, order history, load出username,displayname, balance

______________________________________
修改余额时验证是否为整数
添加点餐的份数

添加用户是否可以订餐




<script type="text/javascript">
    function ChangeIfCanOrder() {
        var canOrder = false;
        if ($("#CanOrderBtn").attr("canorder") == "False") {
            canOrder = true;
        }
        $.ajax({
            type: "POST",
            url: "/Home/AdminManageCanOrderChange",
            datatype: "json",
            data: { "str": canOrder },
            async: false,
            success: function (result) {
                if (result == "true") {
                    $("#IfCanOrderText").text("Can Order Now.");
                    $("#CanOrderBtn").attr("canorder", "true");
                }
                else if (result == "false") {
                    $("#IfCanOrderText").text("Can't Order Now.");
                    $("#CanOrderBtn").attr("canorder", "False");
                }
            },
            error: function (error) {
            }
        });
    }

    function ChangeShopBtn_OnClick() {
        $("#ChangeShopDiv").css("display", "none")
        $("#dropDownList").css("display", "block");
        var value = $("#changeShopBtn").attr("dropDownValue");
        $("#dropDown").attr("value", value);
    }

    function ChangeOkBtn_OnClick() {
        $("#ChangeShopDiv").css("display", "block")
        $("#dropDownList").css("display", "none");
        var str = $("#dropDown").attr("value")

        $.ajax({
            type: "POST",
            url: "/Home/ChangeOrderOfToday",
            datatype: "json",
            data: { "str": str },
            async: false,
            success: function (result) {
                if (result.toString() == "true") {
                    alert("Change ok.")
                    window.location.href = "../../Home/AdminManager";
                }
                else if (result.toString() == "false") {
                    alert("Change error.");
                }
            },
            error: function (error) {
            }
        });

    }

    function ChangeCancelBtn_OnClick() {
        $("#ChangeShopDiv").css("display", "block")
        $("#dropDownList").css("display", "none");
    }
</script>



